package com.gong.DesignPattern.FlyweightPattern;

import java.util.HashMap;
import java.util.Map;

/**
 * @author GongChang
 * @version 1.0
 * @date 2021/6/21 0021 8:44
 */
public class CircleFactory {

    private static Map map = new HashMap();

    public static Shape getShape(String color){
        Shape shape = (Shape) map.get(color);
        if (shape == null){
            Shape shape1 = new Circle(color);
            map.put(color,shape1);
            return shape1;
        }
        return shape;
    }
}
